package Server.info;

import bean.novelBean;
import dao.novelDao;
import dao.userDao;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;

public class userInfoServer {
//    userDao dao=new userDao();
//    HashMap<String, Integer> userBookSelf = dao.queryBookSelf(request);
//    List<String > bookSelf =new LinkedList<>();
//                    for (String novelName:userBookSelf.keySet()) {
//        bookSelf.add(novelName);
//    }
//                    session.setAttribute("bookSelf",bookSelf);

    private HttpSession session;
    private HttpServletRequest request;
    private HttpServletResponse response;

    private novelBean novel;
    public userInfoServer(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException {
        this.request = request;
        this.response = response;
        session = request.getSession();

    }
    public List<novelBean> getHistory(HashMap<String , Integer> bookSelf) throws Exception {
        List<novelBean> historyList=new LinkedList<>();
        novelDao dao =new novelDao();
        for (String novelName  : bookSelf.keySet()) {
            historyList.add( dao.selectByName(novelName));
        }
        return historyList;
    }
}
